<?php

use think\facade\Route;

//Api数据接口
Route::get('/swagger', function() {
    $openapi = \OpenApi\scan('../app/api');
    header('Content-Type: application/json');
    echo $openapi->toJson();
});
//不需要登录验证
Route::rule('login', 'api/Index/login', 'post');
Route::rule('register', 'api/Index/register', 'post');
Route::rule('index', 'api/Index/index', 'get');
Route::rule('article/index', 'api/article.Index/index', 'get');

//需要登录验证
Route::group(function () {
    //登出
    Route::rule('logout', 'api/Index/logout', 'get');
    //检查版本号
    Route::rule('checkVersion', 'api/Index/checkVersion', 'get')->middleware([\app\common\middleware\PreventConcurrent::class],3);//简单高并发预防
    //用户信息
    Route::rule('profile/getUserInfo', 'api/Profile/getUserInfo', 'get');
    //配置列表
    Route::rule('config/index', 'admin/Config/index', 'get');
    Route::rule('profile/messageLog', 'api/Profile/messageLog', 'get');

})->middleware([\app\api\middleware\Auth::class]);
//MISS路由定义
Route::miss('api/Miss/index');
